home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
music_utilities
/
pt144.dms
/
pt144.adf
/
mod2midi
/
Mod2Midi_Source.lha
/
mod2midi.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-06-12
|
2KB
|
76 lines
/* File buffer size.. increase for better performance */
#define BUFFSIZE 512
/* Max line length in text files */
#define MAXSTRING 128
/* MIDI instrument file */
#define DEF_INSFILE "mod2midi.ins"
/* MOD sample to MIDI instrument map */
#define DEF_MAPFILE "mod2midi.map"
/* Note conversion statements: */
#define ANOTE(x) ((x < 0) ? (-x) : (NoteValue(x)))
#define ENOTE(x,y) ((sam->m > 127) ? (sam->m - 128) : (ANOTE(x) + sam->t[y]))
#define EVOL(x) ((x + sam->a[0]) * sam->a[1] / sam->a[2])
/* Amount of bytes of a sample read in when scanning it */
#define SCANSIZE 3000
/* Make sure these fseek positions are defined */
#ifndef SEEK_SET
#define SEEK_SET 0
#define SEEK_CUR 1
#endif
/* Make sure this macro is defined */
#ifndef min
#define min(x,y) ((x > y) ? y : x)
#endif
typedef char *string;
typedef struct bstruct
{
FILE *f; // File to read/write to
unsigned char b[BUFFSIZE]; // Holds buffer data
unsigned int o, r; // Offset in buffer, Bytes actually read
} bfile[1];
struct bpos
{
struct bstruct d; // File data
unsigned long p; // File position
};
typedef struct _X3
{
char n[23]; // Sample name
unsigned int l; // Number of ticks in length (4000 per second)
unsigned char v, m; // Volume of sample, Midi instrument
signed char c; // Midi channel
int t[3]; // Transposition amounts
int a[3]; // Amplification formula: (Vol + a[0]) * a[1] / a[2]
} samp;
typedef struct _X4
{
unsigned char n; // Number of samples
samp s[31]; // Sample information
} samps[1];
/* Bit IDs for conversion modes */
#define MODE_MAPSAMPLES 0x0001
#define MODE_SAVEINFO 0x0002
#define MODE_TRANSPOSE 0x0004
#define MODE_VOLUMESHIFT 0x0008
#define MODE_ABOUT 0x0010
#define MODE_CONVERT 0x0020
/* Modes for HandleGadgetMessages() */
#define HM_LISTVIEW 1
#define HM_ENTRY 2
#define GetString( g ) ((( struct StringInfo * )g->SpecialInfo )->Buffer )